#include "OnTapToFire.h"


OnTapToFire::OnTapToFire( )
{

}


OnTapToFire::~OnTapToFire( )
{

}


bool OnTapToFire::init( )
{
	if( !LBehaviour::init() )
		return false;

	this->unscheduleUpdate( );
	this->setTouchMode( kCCTouchesOneByOne );
	this->setTouchEnabled(true);

	return true;
}




bool OnTapToFire::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{

	return true;
}


void OnTapToFire::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
{
	CCPoint p = pTouch->getLocation();
	BulletManager* pBulletMgr = this->getSource<BulletManager*>();
	if( !pBulletMgr )
		pBulletMgr = BulletManager::sharedBulletManager();
	
	pBulletMgr->fire( p );
}


void OnTapToFire::ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent)
{

}